import { IAppFunc } from "@/core";

/**
 * 获取应用功能配置
 *
 * @return {*}  {IAppFunc[]}
 */
function getAppFuncConfig(): IAppFunc[] {
    return [
{{#each app.allPSAppFuncs as | func |}}
        {
            name: "{{func.name}}",
            funcTag: "{{func.codeName}}",
            appFuncType: "{{func.appFuncType}}",
    {{#eq func.appFuncType 'OPENHTMLPAGE'}}
            htmlPageUrl: "{{func.htmlPageUrl}}",
            openMode: "{{func.openMode}}",
    {{/eq}}
    {{#eq func.appFuncType 'APPVIEW'}}
        {{#if func.psAppView}}
            openViewCodeName: "{{func.psAppView.codeName}}",
        {{/if}}
    {{/eq}}
    {{#if func.psNavigateParams}}
            navigateParam: {
            {{#each func.psNavigateParams as | param |}}
            {{lowerCase param.key}}: "{{#if param.rawValue}}{{param.value}}{{else}}%{{lowerCase param.value}}%{{/if}}",
            {{/each}}
            },
    {{/if}}
    {{#if func.psNavigateContexts}}
            navigateContext: {
            {{#each func.psNavigateContexts as | context |}}
            {{lowerCase context.key}}: "{{#if context.rawValue}}{{context.value}}{{else}}%{{lowerCase context.value}}%{{/if}}",
            {{/each}}
            },
    {{/if}}
        },
{{/each}}
    ]
}

export const AppFuncConfig = getAppFuncConfig();